package cn.lr.basic.util;

import lombok.Data;

/**
 * 封装工具类-AjaxResult
 */
@Data
public class AjaxResult {
    public Boolean success = Boolean.TRUE;
    public String message = "操作成功！";
    public Object resultObj; // 封装额外参数


    private AjaxResult() {}

    public static AjaxResult me() { // 提供获得对象的静态方法，不用二次在内存中创建对象(单例模式)
        return new AjaxResult();
    }

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }
}


